﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="buyer_Permission.aspx.cs"
    Inherits="PeisongWeb.buyer_Permission" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>采购配送系统-账户管理</title>
    <!--#include file="../global.inc" -->

    <script type="text/javascript">


        function withchk(code, value) {
            for (var i = 1; i <= value; i++) {

                document.getElementById(code + i).checked = true;
            }

        }

        function withoutchk(code, value) {
            for (var i = 1; i <= 2; i++) {

                document.getElementById(code + i).checked = false;
            }

        }


        function getPopedom() {
            var ret = "";
            var len = document.getElementsByName("chk_popedom").length;


            for (i = 0; i < len / 2; i++) {
                if (document.getElementById("hid_chkPopedom" + i).value != "") {
                    ret += (ret == "" ? "" : ",") + document.getElementById("hid_chkPopedom" + i).value;
                }
            }


            document.getElementById("hid_Popedom").value = ret;
            if (ret != "")
                return true;
            else
                return false;


        }

        function selChkBox(code, value, index) {

            //alert(code + "   " + value + "   " + index)
            var obj = document.getElementById(code + value);
            if (obj.checked == true) {
                withchk(code, value);

                document.getElementById("hid_chkPopedom" + index).value = code + value;

            }
            else {
                withoutchk(code, value)
                document.getElementById("hid_chkPopedom" + index).value = "";

            }

        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="container">
        <uc1:headerV2 runat="server" ID="header1" />
        <div id="homemain">
            <div id="main">
                <div class="title">
                    <div class="title_text">
                        <ul>
                            <li class="color1">账户管理</li>
                            <li class="color2">-权限设置</li>
                        </ul>
                    </div>
                </div>
                <div class="line_top">
                </div>
                <div id="mainmiddle">
                    <div class="left">
                        <div class="login" id="div_reg_2">
                            <div class="login_title">
                                <asp:Label runat="server" ID="lbl_CustomerName"></asp:Label>
                            </div>
                            <div class="login_main">
                                <ul>
                                    <asp:Repeater ID="rpt_list" runat="server">
                                        <ItemTemplate>
                                            <li style="font-weight: bold; margin-top: 10px; font-style: italic; font-size: 14px;
                                                border-bottom: 1px solid #99bbe8; width: 97%; height: 12px; <%#Eval("code").ToString()=="A"?"": "display:none" %>">
                                                <label>
                                                    <%#Eval("name")%></label>
                                            </li>
                                            <li style="<%#Container.ItemIndex%2==0?"background-color:White;": "" %><%#Eval("code").ToString()=="A"?"display:none":"" %>">
                                                <label>
                                                    <%#Eval("name")%>
                                                </label>
                                                <input id="<%#Eval("parentCode") %><%#Eval("code") %>1" name="chk_popedom" type="checkbox"
                                                    onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','1','<%#Container.ItemIndex %>')"
                                                    value="<%#Eval("parentCode") %><%#Eval("code") %>1" <%#Eval("isChecked")!=DBNull.Value?(Convert.ToInt32(Eval("isChecked"))>=1?"checked":""):"" %> />查看&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input id="<%#Eval("parentCode") %><%#Eval("code") %>2" name="chk_popedom" type="checkbox"
                                                    onclick="selChkBox('<%#Eval("parentCode") %><%#Eval("code") %>','2','<%#Container.ItemIndex %>')"
                                                    value="<%#Eval("parentCode") %><%#Eval("code") %>2" <%#Eval("isChecked")!=DBNull.Value?(Convert.ToInt32(Eval("isChecked"))>=2?"checked":""):"" %> />编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                <input id="hid_chkPopedom<%#Container.ItemIndex %>" type="hidden" value="<%#Eval("isChecked") != DBNull.Value ? Eval("parentCode").ToString() + Eval("code").ToString() + Eval("isChecked").ToString() : ""%>" />
                                            </li>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    <li style="padding-left: 240px; padding-top: 30px;">
                                        <asp:Button runat="server" ID="bt_save" CssClass="button_red_text button_red" OnClientClick="return getPopedom();"
                                            OnClick="bt_save_Click" Text="保存" />
                                        <input id="hid_Popedom" runat="server" type="hidden" />
                                        <input type="button" class="button_red_text button_red" value="返回" onclick="javascript:window.location.href='buyer_customerList.html'" />
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="right">
                        <div class="right_login">
                            <ul>
                                <li style="color: #255966">如何设置用户权限？</li>
                                <li>&nbsp;</li>
                                <li>选中用户需要查看的功能，</li>
                                <li>保存后设置完成。</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <uc1:footerV2 runat="server" ID="footer1" />
    </div>
    <input type="hidden" runat="server" id="hid_vipType" />
    <input type="hidden" runat="server" id="hid_source" />
    <input type="hidden" runat="server" id="hid_type" />
    <input type="hidden" runat="server" id="hid_payMethod" />
    </form>
</body>
</html>
